Integrand size = 43, antiderivative size = 306 \[ \int \frac {(c i+d i x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2}{a g+b g x} \, dx=\frac {d i (a+b x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2}{b^2 g}+\frac {2 B (b c-a d) i n \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \log \left (\frac {b c-a d}{b (c+d x)}\right )}{b^2 g}-\frac {(b c-a d) i \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2 \log \left (1-\frac {b (c+d x)}{d (a+b x)}\right )}{b^2 g}+\frac {2 B^2 (b c-a d) i n^2 \operatorname {PolyLog}\left (2,\frac {d (a+b x)}{b (c+d x)}\right )}{b^2 g}+\frac {2 B (b c-a d) i n \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \operatorname {PolyLog}\left (2,\frac {b (c+d x)}{d (a+b x)}\right )}{b^2 g}+\frac {2 B^2 (b c-a d) i n^2 \operatorname {PolyLog}\left (3,\frac {b (c+d x)}{d (a+b x)}\right )}{b^2 g} \]
d*i*(b*x+a)*(A+B*ln(e*((b*x+a)/(d*x+c))^n))^2/b^2/g+2*B*(-a*d+b*c)*i*n*(A+ B*ln(e*((b*x+a)/(d*x+c))^n))*ln((-a*d+b*c)/b/(d*x+c))/b^2/g-(-a*d+b*c)*i*( A+B*ln(e*((b*x+a)/(d*x+c))^n))^2*ln(1-b*(d*x+c)/d/(b*x+a))/b^2/g+2*B^2*(-a *d+b*c)*i*n^2*polylog(2,d*(b*x+a)/b/(d*x+c))/b^2/g+2*B*(-a*d+b*c)*i*n*(A+B *ln(e*((b*x+a)/(d*x+c))^n))*polylog(2,b*(d*x+c)/d/(b*x+a))/b^2/g+2*B^2*(-a *d+b*c)*i*n^2*polylog(3,b*(d*x+c)/d/(b*x+a))/b^2/g
Leaf count is larger than twice the leaf count of optimal. \(1372\) vs. \(2(306)=612\).
Time = 0.59 (sec) , antiderivative size = 1372, normalized size of antiderivative = 4.48 \[ \int \frac {(c i+d i x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2}{a g+b g x} \, dx =\text {Too large to display} \]
(i*(3*b*d*x*(A + B*Log[e*((a + b*x)/(c + d*x))^n] - B*n*Log[(a + b*x)/(c + d*x)])^2 + 3*(b*c - a*d)*Log[a + b*x]*(A + B*Log[e*((a + b*x)/(c + d*x))^ n] - B*n*Log[(a + b*x)/(c + d*x)])^2 - 3*B*n*(A + B*Log[e*((a + b*x)/(c + d*x))^n] - B*n*Log[(a + b*x)/(c + d*x)])*(a*d*Log[a/b + x]^2 - 2*a*d*Log[a /b + x]*(1 + Log[a + b*x]) + 2*(-(b*c) + a*d + Log[c/d + x]*(b*c + a*d*Log [a + b*x] - a*d*Log[(d*(a + b*x))/(-(b*c) + a*d)]) + (-(b*d*x) + a*d*Log[a + b*x])*Log[(a + b*x)/(c + d*x)]) - 2*a*d*PolyLog[2, (b*(c + d*x))/(b*c - a*d)]) + 3*b*B*c*n*(A + B*Log[e*((a + b*x)/(c + d*x))^n] - B*n*Log[(a + b *x)/(c + d*x)])*(Log[a/b + x]^2 - 2*Log[a + b*x]*(Log[a/b + x] - Log[c/d + x] - Log[(a + b*x)/(c + d*x)]) - 2*(Log[c/d + x]*Log[(d*(a + b*x))/(-(b*c ) + a*d)] + PolyLog[2, (b*(c + d*x))/(b*c - a*d)])) - B^2*n^2*(a*d*Log[a/b + x]^3 - 3*d*(2*b*x - 2*(a + b*x)*Log[a/b + x] + (a + b*x)*Log[a/b + x]^2 ) - 3*b*(2*d*x - 2*(c + d*x)*Log[c/d + x] + (c + d*x)*Log[c/d + x]^2) - 3* d*(b*x - a*Log[a + b*x])*(-Log[a/b + x] + Log[c/d + x] + Log[(a + b*x)/(c + d*x)])^2 + 6*(a*d + 2*b*d*x - b*d*x*Log[c/d + x] - b*c*Log[c + d*x] + Lo g[a/b + x]*(-(d*(a + b*x)) + d*(a + b*x)*Log[c/d + x] + (b*c - a*d)*Log[(b *(c + d*x))/(b*c - a*d)]) + (b*c - a*d)*PolyLog[2, (d*(a + b*x))/(-(b*c) + a*d)]) - 3*(Log[a/b + x] - Log[c/d + x] - Log[(a + b*x)/(c + d*x)])*(-2*b *c + 2*a*d - 2*d*(a + b*x)*Log[a/b + x] + a*d*Log[a/b + x]^2 + 2*Log[c/d + x]*(b*(c + d*x) - a*d*Log[(d*(a + b*x))/(-(b*c) + a*d)]) - 2*a*d*PolyL...
Time = 1.05 (sec) , antiderivative size = 288, normalized size of antiderivative = 0.94, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.186, Rules used = {2961, 2789, 2755, 2754, 2779, 2821, 2838, 7143}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {(c i+d i x) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{a g+b g x} \, dx\) |
\(\Big \downarrow \) 2961 |
\(\displaystyle \frac {i (b c-a d) \int \frac {(c+d x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2}{(a+b x) \left (b-\frac {d (a+b x)}{c+d x}\right )^2}d\frac {a+b x}{c+d x}}{g}\) |
\(\Big \downarrow \) 2789 |
\(\displaystyle \frac {i (b c-a d) \left (\frac {d \int \frac {\left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2}{\left (b-\frac {d (a+b x)}{c+d x}\right )^2}d\frac {a+b x}{c+d x}}{b}+\frac {\int \frac {(c+d x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2}{(a+b x) \left (b-\frac {d (a+b x)}{c+d x}\right )}d\frac {a+b x}{c+d x}}{b}\right )}{g}\) |
\(\Big \downarrow \) 2755 |
\(\displaystyle \frac {i (b c-a d) \left (\frac {d \left (\frac {(a+b x) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{b (c+d x) \left (b-\frac {d (a+b x)}{c+d x}\right )}-\frac {2 B n \int \frac {A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )}{b-\frac {d (a+b x)}{c+d x}}d\frac {a+b x}{c+d x}}{b}\right )}{b}+\frac {\int \frac {(c+d x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2}{(a+b x) \left (b-\frac {d (a+b x)}{c+d x}\right )}d\frac {a+b x}{c+d x}}{b}\right )}{g}\) |
\(\Big \downarrow \) 2754 |
\(\displaystyle \frac {i (b c-a d) \left (\frac {\int \frac {(c+d x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2}{(a+b x) \left (b-\frac {d (a+b x)}{c+d x}\right )}d\frac {a+b x}{c+d x}}{b}+\frac {d \left (\frac {(a+b x) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{b (c+d x) \left (b-\frac {d (a+b x)}{c+d x}\right )}-\frac {2 B n \left (\frac {B n \int \frac {(c+d x) \log \left (1-\frac {d (a+b x)}{b (c+d x)}\right )}{a+b x}d\frac {a+b x}{c+d x}}{d}-\frac {\log \left (1-\frac {d (a+b x)}{b (c+d x)}\right ) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )}{d}\right )}{b}\right )}{b}\right )}{g}\) |
\(\Big \downarrow \) 2779 |
\(\displaystyle \frac {i (b c-a d) \left (\frac {d \left (\frac {(a+b x) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{b (c+d x) \left (b-\frac {d (a+b x)}{c+d x}\right )}-\frac {2 B n \left (\frac {B n \int \frac {(c+d x) \log \left (1-\frac {d (a+b x)}{b (c+d x)}\right )}{a+b x}d\frac {a+b x}{c+d x}}{d}-\frac {\log \left (1-\frac {d (a+b x)}{b (c+d x)}\right ) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )}{d}\right )}{b}\right )}{b}+\frac {\frac {2 B n \int \frac {(c+d x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right ) \log \left (1-\frac {b (c+d x)}{d (a+b x)}\right )}{a+b x}d\frac {a+b x}{c+d x}}{b}-\frac {\log \left (1-\frac {b (c+d x)}{d (a+b x)}\right ) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{b}}{b}\right )}{g}\) |
\(\Big \downarrow \) 2821 |
\(\displaystyle \frac {i (b c-a d) \left (\frac {\frac {2 B n \left (\operatorname {PolyLog}\left (2,\frac {b (c+d x)}{d (a+b x)}\right ) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )-B n \int \frac {(c+d x) \operatorname {PolyLog}\left (2,\frac {b (c+d x)}{d (a+b x)}\right )}{a+b x}d\frac {a+b x}{c+d x}\right )}{b}-\frac {\log \left (1-\frac {b (c+d x)}{d (a+b x)}\right ) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{b}}{b}+\frac {d \left (\frac {(a+b x) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{b (c+d x) \left (b-\frac {d (a+b x)}{c+d x}\right )}-\frac {2 B n \left (\frac {B n \int \frac {(c+d x) \log \left (1-\frac {d (a+b x)}{b (c+d x)}\right )}{a+b x}d\frac {a+b x}{c+d x}}{d}-\frac {\log \left (1-\frac {d (a+b x)}{b (c+d x)}\right ) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )}{d}\right )}{b}\right )}{b}\right )}{g}\) |
\(\Big \downarrow \) 2838 |
\(\displaystyle \frac {i (b c-a d) \left (\frac {\frac {2 B n \left (\operatorname {PolyLog}\left (2,\frac {b (c+d x)}{d (a+b x)}\right ) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )-B n \int \frac {(c+d x) \operatorname {PolyLog}\left (2,\frac {b (c+d x)}{d (a+b x)}\right )}{a+b x}d\frac {a+b x}{c+d x}\right )}{b}-\frac {\log \left (1-\frac {b (c+d x)}{d (a+b x)}\right ) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{b}}{b}+\frac {d \left (\frac {(a+b x) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{b (c+d x) \left (b-\frac {d (a+b x)}{c+d x}\right )}-\frac {2 B n \left (-\frac {\log \left (1-\frac {d (a+b x)}{b (c+d x)}\right ) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )}{d}-\frac {B n \operatorname {PolyLog}\left (2,\frac {d (a+b x)}{b (c+d x)}\right )}{d}\right )}{b}\right )}{b}\right )}{g}\) |
\(\Big \downarrow \) 7143 |
\(\displaystyle \frac {i (b c-a d) \left (\frac {d \left (\frac {(a+b x) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{b (c+d x) \left (b-\frac {d (a+b x)}{c+d x}\right )}-\frac {2 B n \left (-\frac {\log \left (1-\frac {d (a+b x)}{b (c+d x)}\right ) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )}{d}-\frac {B n \operatorname {PolyLog}\left (2,\frac {d (a+b x)}{b (c+d x)}\right )}{d}\right )}{b}\right )}{b}+\frac {\frac {2 B n \left (\operatorname {PolyLog}\left (2,\frac {b (c+d x)}{d (a+b x)}\right ) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )+B n \operatorname {PolyLog}\left (3,\frac {b (c+d x)}{d (a+b x)}\right )\right )}{b}-\frac {\log \left (1-\frac {b (c+d x)}{d (a+b x)}\right ) \left (B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )+A\right )^2}{b}}{b}\right )}{g}\) |
((b*c - a*d)*i*((d*(((a + b*x)*(A + B*Log[e*((a + b*x)/(c + d*x))^n])^2)/( b*(c + d*x)*(b - (d*(a + b*x))/(c + d*x))) - (2*B*n*(-(((A + B*Log[e*((a + b*x)/(c + d*x))^n])*Log[1 - (d*(a + b*x))/(b*(c + d*x))])/d) - (B*n*PolyL og[2, (d*(a + b*x))/(b*(c + d*x))])/d))/b))/b + (-(((A + B*Log[e*((a + b*x )/(c + d*x))^n])^2*Log[1 - (b*(c + d*x))/(d*(a + b*x))])/b) + (2*B*n*((A + B*Log[e*((a + b*x)/(c + d*x))^n])*PolyLog[2, (b*(c + d*x))/(d*(a + b*x))] + B*n*PolyLog[3, (b*(c + d*x))/(d*(a + b*x))]))/b)/b))/g
3.2.63.3.1 Defintions of rubi rules used
Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)/((d_) + (e_.)*(x_)), x_Symb ol] :> Simp[Log[1 + e*(x/d)]*((a + b*Log[c*x^n])^p/e), x] - Simp[b*n*(p/e) Int[Log[1 + e*(x/d)]*((a + b*Log[c*x^n])^(p - 1)/x), x], x] /; FreeQ[{a, b, c, d, e, n}, x] && IGtQ[p, 0]
Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)/((d_) + (e_.)*(x_))^2, x_Sy mbol] :> Simp[x*((a + b*Log[c*x^n])^p/(d*(d + e*x))), x] - Simp[b*n*(p/d) Int[(a + b*Log[c*x^n])^(p - 1)/(d + e*x), x], x] /; FreeQ[{a, b, c, d, e, n, p}, x] && GtQ[p, 0]
Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)/((x_)*((d_) + (e_.)*(x_)^(r _.))), x_Symbol] :> Simp[(-Log[1 + d/(e*x^r)])*((a + b*Log[c*x^n])^p/(d*r)) , x] + Simp[b*n*(p/(d*r)) Int[Log[1 + d/(e*x^r)]*((a + b*Log[c*x^n])^(p - 1)/x), x], x] /; FreeQ[{a, b, c, d, e, n, r}, x] && IGtQ[p, 0]
Int[(((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*((d_) + (e_.)*(x_))^(q_))/ (x_), x_Symbol] :> Simp[1/d Int[(d + e*x)^(q + 1)*((a + b*Log[c*x^n])^p/x ), x], x] - Simp[e/d Int[(d + e*x)^q*(a + b*Log[c*x^n])^p, x], x] /; Free Q[{a, b, c, d, e, n}, x] && IGtQ[p, 0] && LtQ[q, -1] && IntegerQ[2*q]
Int[(Log[(d_.)*((e_) + (f_.)*(x_)^(m_.))]*((a_.) + Log[(c_.)*(x_)^(n_.)]*(b _.))^(p_.))/(x_), x_Symbol] :> Simp[(-PolyLog[2, (-d)*f*x^m])*((a + b*Log[c *x^n])^p/m), x] + Simp[b*n*(p/m) Int[PolyLog[2, (-d)*f*x^m]*((a + b*Log[c *x^n])^(p - 1)/x), x], x] /; FreeQ[{a, b, c, d, e, f, m, n}, x] && IGtQ[p, 0] && EqQ[d*e, 1]
Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2 , (-c)*e*x^n]/n, x] /; FreeQ[{c, d, e, n}, x] && EqQ[c*d, 1]
Int[((A_.) + Log[(e_.)*(((a_.) + (b_.)*(x_))/((c_.) + (d_.)*(x_)))^(n_.)]*( B_.))^(p_.)*((f_.) + (g_.)*(x_))^(m_.)*((h_.) + (i_.)*(x_))^(q_.), x_Symbol ] :> Simp[(b*c - a*d)^(m + q + 1)*(g/b)^m*(i/d)^q Subst[Int[x^m*((A + B*L og[e*x^n])^p/(b - d*x)^(m + q + 2)), x], x, (a + b*x)/(c + d*x)], x] /; Fre eQ[{a, b, c, d, e, f, g, h, i, A, B, n, p}, x] && NeQ[b*c - a*d, 0] && EqQ[ b*f - a*g, 0] && EqQ[d*h - c*i, 0] && IntegersQ[m, q]
Int[PolyLog[n_, (c_.)*((a_.) + (b_.)*(x_))^(p_.)]/((d_.) + (e_.)*(x_)), x_S ymbol] :> Simp[PolyLog[n + 1, c*(a + b*x)^p]/(e*p), x] /; FreeQ[{a, b, c, d , e, n, p}, x] && EqQ[b*d, a*e]
\[\int \frac {\left (d i x +c i \right ) {\left (A +B \ln \left (e \left (\frac {b x +a}{d x +c}\right )^{n}\right )\right )}^{2}}{b g x +a g}d x\]
\[ \int \frac {(c i+d i x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2}{a g+b g x} \, dx=\int { \frac {{\left (d i x + c i\right )} {\left (B \log \left (e \left (\frac {b x + a}{d x + c}\right )^{n}\right ) + A\right )}^{2}}{b g x + a g} \,d x } \]
integral((A^2*d*i*x + A^2*c*i + (B^2*d*i*x + B^2*c*i)*log(e*((b*x + a)/(d* x + c))^n)^2 + 2*(A*B*d*i*x + A*B*c*i)*log(e*((b*x + a)/(d*x + c))^n))/(b* g*x + a*g), x)
\[ \int \frac {(c i+d i x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2}{a g+b g x} \, dx=\frac {i \left (\int \frac {A^{2} c}{a + b x}\, dx + \int \frac {A^{2} d x}{a + b x}\, dx + \int \frac {B^{2} c \log {\left (e \left (\frac {a}{c + d x} + \frac {b x}{c + d x}\right )^{n} \right )}^{2}}{a + b x}\, dx + \int \frac {2 A B c \log {\left (e \left (\frac {a}{c + d x} + \frac {b x}{c + d x}\right )^{n} \right )}}{a + b x}\, dx + \int \frac {B^{2} d x \log {\left (e \left (\frac {a}{c + d x} + \frac {b x}{c + d x}\right )^{n} \right )}^{2}}{a + b x}\, dx + \int \frac {2 A B d x \log {\left (e \left (\frac {a}{c + d x} + \frac {b x}{c + d x}\right )^{n} \right )}}{a + b x}\, dx\right )}{g} \]
i*(Integral(A**2*c/(a + b*x), x) + Integral(A**2*d*x/(a + b*x), x) + Integ ral(B**2*c*log(e*(a/(c + d*x) + b*x/(c + d*x))**n)**2/(a + b*x), x) + Inte gral(2*A*B*c*log(e*(a/(c + d*x) + b*x/(c + d*x))**n)/(a + b*x), x) + Integ ral(B**2*d*x*log(e*(a/(c + d*x) + b*x/(c + d*x))**n)**2/(a + b*x), x) + In tegral(2*A*B*d*x*log(e*(a/(c + d*x) + b*x/(c + d*x))**n)/(a + b*x), x))/g
\[ \int \frac {(c i+d i x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2}{a g+b g x} \, dx=\int { \frac {{\left (d i x + c i\right )} {\left (B \log \left (e \left (\frac {b x + a}{d x + c}\right )^{n}\right ) + A\right )}^{2}}{b g x + a g} \,d x } \]
A^2*d*i*(x/(b*g) - a*log(b*x + a)/(b^2*g)) + A^2*c*i*log(b*g*x + a*g)/(b*g ) + (B^2*b*d*i*x + (b*c*i - a*d*i)*B^2*log(b*x + a))*log((d*x + c)^n)^2/(b ^2*g) - integrate(-(B^2*b^2*c^2*i*log(e)^2 + 2*A*B*b^2*c^2*i*log(e) + (B^2 *b^2*d^2*i*log(e)^2 + 2*A*B*b^2*d^2*i*log(e))*x^2 + (B^2*b^2*d^2*i*x^2 + 2 *B^2*b^2*c*d*i*x + B^2*b^2*c^2*i)*log((b*x + a)^n)^2 + 2*(B^2*b^2*c*d*i*lo g(e)^2 + 2*A*B*b^2*c*d*i*log(e))*x + 2*(B^2*b^2*c^2*i*log(e) + A*B*b^2*c^2 *i + (B^2*b^2*d^2*i*log(e) + A*B*b^2*d^2*i)*x^2 + 2*(B^2*b^2*c*d*i*log(e) + A*B*b^2*c*d*i)*x)*log((b*x + a)^n) - 2*(B^2*b^2*c^2*i*log(e) + A*B*b^2*c ^2*i + ((i*n + i*log(e))*B^2*b^2*d^2 + A*B*b^2*d^2*i)*x^2 + (2*A*B*b^2*c*d *i + (a*b*d^2*i*n + 2*b^2*c*d*i*log(e))*B^2)*x + ((b^2*c*d*i*n - a*b*d^2*i *n)*B^2*x + (a*b*c*d*i*n - a^2*d^2*i*n)*B^2)*log(b*x + a) + (B^2*b^2*d^2*i *x^2 + 2*B^2*b^2*c*d*i*x + B^2*b^2*c^2*i)*log((b*x + a)^n))*log((d*x + c)^ n))/(b^3*d*g*x^2 + a*b^2*c*g + (b^3*c*g + a*b^2*d*g)*x), x)
\[ \int \frac {(c i+d i x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2}{a g+b g x} \, dx=\int { \frac {{\left (d i x + c i\right )} {\left (B \log \left (e \left (\frac {b x + a}{d x + c}\right )^{n}\right ) + A\right )}^{2}}{b g x + a g} \,d x } \]
Timed out. \[ \int \frac {(c i+d i x) \left (A+B \log \left (e \left (\frac {a+b x}{c+d x}\right )^n\right )\right )^2}{a g+b g x} \, dx=\int \frac {\left (c\,i+d\,i\,x\right )\,{\left (A+B\,\ln \left (e\,{\left (\frac {a+b\,x}{c+d\,x}\right )}^n\right )\right )}^2}{a\,g+b\,g\,x} \,d x \]